<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // console.log(c);
    // var a = 10, b = 20, c = a + b;
    // console.log(c);

    function fn(sum) {
        if (sum <= 1) {
            return 1;
        }
        return sum + fn(sum - 1);
    }
    var result = fn(5);
    console.log(result);


    // function fn(i, sum) {
    //     sum *= i;
    //     if (i <= 1) {
    //         return sum;
    //     }
    //     return fn(--i, sum);
    // }
    // var result = fn(5, 1);
    // console.log(result);
</script>

</html>